import { IPineStudyResult, LibraryPineStudy, RawStudyMetaInfoId, StudyPlotType } from "./charting_library/charting_library";

let temp11= {
    name: 'Custom Styles For Every Point',
    metainfo: {
        _metainfoVersion: 51,
        id: 'CustomStylesForEveryPoint@tv-basicstudies-1' as RawStudyMetaInfoId,
        description: 'Custom Styles For Every Point',
        shortDescription: 'Custom Styles For Every Point',
        is_price_study: false,
        isCustomIndicator: true,
        plots: [
            {
                id: 'plot_0',
                type: "line",
            },
            {
                id: 'plot_1',
                type: "colorer",
                target: 'plot_0',
                palette: 'paletteId1',
            },
        ],
        palettes: {
            paletteId1: {
                colors: {
                    0: {
                        name: 'First color',
                    },
                    1: {
                        name: 'Second color',
                    },
                },
            },
        },
        defaults: {
            palettes: {
                paletteId1: {
                    colors: {
                        0: {
                            color: '#fff',
                            width: 1,
                            style: 0,
                        },
                        1: {
                            color: 'red',
                            width: 3,
                            style: 1,
                        },
                    },
                },
            },
            styles: {},
            precision: 4,
            inputs: {},
        },
        styles: {
            plot_0: {
                title: 'Equity value',
                histogramBase: 0,
            },
        },
        inputs: [],
        format: {
            type: 'price',
            precision: 4,
        },
    },
    constructor: function (
        this: LibraryPineStudy<IPineStudyResult>
    ) {
        this.main = function (context, inputCallback) {
            this._context = context;
            this._input = inputCallback;

            const value = Math.random() * 200;
            const colorIndex = value > 100 ? 0 : 1;
            return [value, colorIndex];
        };
    },
}
export {temp11}